package com.zytool.easyrestful.demo.controller;

import com.zytool.easyrestful.core.GenericController;
import com.zytool.easyrestful.core.bean.ResultBean;
import com.zytool.easyrestful.demo.entity.UserEntity;
import com.zytool.easyrestful.demo.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用户管理")
@RestController
@RequestMapping("/user")
public class UserController extends GenericController<UserEntity> {

    private UserService userService;

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
        super.setGenericService(userService);
    }

    @ApiOperation("查询列表")
    @GetMapping("/test")
    public Object list(@RequestParam int id) {
        return ResultBean.success(userService.getUserById(id));
    }
}
